package com.exp.service;

import com.exp.dao.MyFoodMapper;
import com.exp.dao.more.MoreMyFoodMapper;
import com.exp.model.Business;
import com.exp.model.MyFood;
import com.exp.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by guojianyu on 2016/3/30.
 */
@Service
@Transactional
public class MyFoodService {
    @Autowired
    private MoreMyFoodMapper moreMyFoodMapper;
    @Autowired
    private MyFoodMapper myFoodMapper;
    /*管理员获取商家上传总列表*/
    public List<MyFood> getMyFoodListAll(Map map) {
        return moreMyFoodMapper.getMyFoodListAll(map);
    }
    /*商家获取自己上传餐品列表*/
    public List<MyFood> getMyFoodList(Map map) {
        return moreMyFoodMapper.getMyFoodList(map);
    }
    /*更改商家审核状态*/
    public int enabled(MyFood myFood) {
        return myFoodMapper.updateByPrimaryKeySelective(myFood);
    }
    /*商家对菜品数据操纵*/
    public  int delete(Integer id){
        return  myFoodMapper.deleteByPrimaryKey(id);
    }
    public int add(MyFood myFood){
        return  myFoodMapper.insert(myFood);
    }
    public int update(MyFood myFood){
        return  myFoodMapper.updateByPrimaryKeySelective(myFood);
    }

}
